package di.ass.main.helps;

import di.ass.database.DatabaseHandler;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import di.ass.R;

public class HowToDelAdapter extends ArrayAdapter<String> {
	private final Context context;
	@SuppressWarnings("unused")
	private final String[] values;

	public HowToDelAdapter(Context context, String[] values) {
		// TODO Auto-generated constructor stub
		super(context, R.layout.help_del, values);
		this.context = context;
		this.values = values;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.help_del, parent, false);
		TextView textView1 = (TextView) rowView
				.findViewById(R.id.helpDelTextView1);
		TextView textView2 = (TextView) rowView
				.findViewById(R.id.helpDelTextView2);
		TextView textView3 = (TextView) rowView
				.findViewById(R.id.helpDelTextView3);
		DatabaseHandler db = new DatabaseHandler(context);
		String[] valstrHowAdd = null;
		if (db.getLanguageUse().equals("Việt Nam")) {
			valstrHowAdd = context.getResources().getStringArray(
					R.array.howToDel_vi);
		} else if (db.getLanguageUse().equals("English")) {
			valstrHowAdd = context.getResources().getStringArray(
					R.array.howToDel_eng);
		}
		if (position == 0) {
			textView1.setText(valstrHowAdd[0]);
			textView2.setText(valstrHowAdd[1]);
			textView3.setText(valstrHowAdd[2]);
		}
		return rowView;
	}

}
